package com.sctvcloud.renhe.ui.dialog;

import android.app.Dialog;
import android.os.Bundle;
import android.os.Message;
import android.view.View;

import com.ruihang.generalibrary.ui.dialog.BaseDialogFragment;
import com.ruihang.generalibrary.ui.widget.CustomFontTextView;
import com.sctvcloud.renhe.R;

/**
 * Created by Administrator on 2017/8/29 0029.
 * 当WiFi未开启时，提示用户
 */

public class NetModeDiaFragment extends BaseDialogFragment implements View.OnClickListener {
    private CustomFontTextView no_ct;
    private CustomFontTextView ok_ct;
    public static final int NO_TAG = 101;
    public static final int OK_TAG = 202;

    @Override
    protected int getContentRes() {
        return R.layout.dia_net_mode_fragment;
    }

    @Override
    protected void initViews(Dialog dialog, Bundle savedInstanceState) {
        no_ct = (CustomFontTextView) dialog.findViewById(R.id.net_mode_fragment_no);
        ok_ct = (CustomFontTextView) dialog.findViewById(R.id.net_mode_fragment_ok);
        no_ct.setOnClickListener(this);
        ok_ct.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        Message message = new Message();
        if (v == no_ct) {
            if (callBack != null) {
                message.what = NO_TAG;
                callBack.onCallBackMsg(this, message);
            }
        } else if (v == ok_ct) {
            if (callBack != null) {
                message.what = OK_TAG;
                callBack.onCallBackMsg(this, message);
            }
        }
        dismissAllowingStateLoss();
    }
}
